package com.heima.comment.feign;

import com.heima.apis.comment.ICommentClient;
import com.heima.comment.service.CommentRepayService;
import com.heima.comment.service.CommentService;
import com.heima.model.article.dtos.ArticleCommonDto;
import com.heima.model.comment.dtos.ALLCommentListDto;
import com.heima.model.comment.dtos.CommentLikeDto;
import com.heima.model.comment.dtos.CommentListDto;
import com.heima.model.comment.dtos.CommentRepaySaveDto;
import com.heima.model.comment.vos.WmCommentListVo;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmUser;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author JianKang
 * @create 2023-11-06 15:26
 */
@RestController
@RequestMapping("/api/v1/comment/manage")
public class CommentClient implements ICommentClient {

    @Autowired
    CommentService commentService;

    @Autowired
    CommentRepayService commentRepayService;

    @DeleteMapping("/del_comment/{commentId}")
    @Override
    public ResponseResult delComment(@PathVariable String commentId) {
        return commentService.delComment(commentId);
    }

    @DeleteMapping("/del_comment_repay/{commentRepayId}")
    public ResponseResult delCommentRepay(String commentRepayId) {
        return commentRepayService.delCommentRepay(commentRepayId);
    }

    @PostMapping("/comment_repay")
    public ResponseResult commentRepay(@RequestBody CommentRepaySaveDto dto) {
        return commentRepayService.saveCommentRepay(dto);
    }

    @PostMapping("/update_comment_status")
    public ResponseResult updateCommentStatus(@RequestBody ArticleCommonDto dto) {
        return null;
    }

    @PostMapping("/find_news_comments")
    public ResponseResult findNewsComments(@RequestBody ALLCommentListDto dto) {
        return commentService.findNewsComments(dto);
    }

    @PostMapping("/like")
    public ResponseResult like(@RequestBody CommentLikeDto dto) {
        return commentService.likeComment(dto);
    }
}
